Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow Caches to return a name borrowed from themselves #130

Closed
wants to merge 1 commit into from

Conversation

ISSOtm
Copy link
Contributor

@ISSOtm ISSOtm commented Sep 16, 2024

This is useful when the name comes not from the handle, but from the cache itself.

For example, if the cache is a sort of Vec<{name: String, contents: Source<...>}> (then the handles are usizes).

This is useful when the name comes not from the handle, but from the cache itself.
For example, if the cache is a sort of `Vec<{name: String, contents: Source<...>}>`
(the the handles are `usize`s).
@ISSOtm
Copy link
Contributor Author

ISSOtm commented Sep 16, 2024

Never mind, this works with my own code, but not all of ariadne's. I tried another fix, but it breaks when trying to write (because fetch takes a &mut self, which gets extended by the result's lifetime extending that ref1). So I'll close this. Sorry!

Footnotes

  1. This can be fixed by fetch returning the self back immutably, but would be a breaking change to the trait's signature. @zesterer, if I'm correct, you want ariadne 2.0 to use a different architecture in the ariadne2 branch, right?

@ISSOtm ISSOtm closed this Sep 16, 2024
@ISSOtm ISSOtm deleted the name-from-cache branch September 16, 2024 18:02
@zesterer
Copy link
Owner

if I'm correct, you want ariadne 2.0 to use a different architecture in the ariadne2 branch, right?

Yes, I think there are several fundamental problems with Source/Cache.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants